<template>
    <div class="reg">
        注册页面
    </div>
    <hr>
    <button @click="router.back()">返回</button>
    <div>名称：{{ route.params.name }}</div>
    <div>价格：{{ item?.price }}</div>
    <div>ID: {{ route.params.id }}</div>

</template>
<script setup lang="ts">
import { data } from './list.json'
import { useRoute, useRouter } from 'vue-router';
const route = useRoute()
const router = useRouter()
const item = data.find(v => v.id == Number(route.params.id)) // 通过params传入id来进行取值


</script>
<style lang="less">
.reg {
    width: 300px;
    height: 20px;
    background: red;
}
</style>